FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch AS build
WORKDIR /src
COPY ["General.Mvc/General.Mvc.csproj", "General.Mvc/"]
COPY ["General.Framework/General.Framework.csproj", "General.Framework/"]
COPY ["General.Core/General.Core.csproj", "General.Core/"]
COPY ["General.Services/General.Services.csproj", "General.Services/"]
COPY ["General.Entities/General.Entities.csproj", "General.Entities/"]
RUN dotnet restore "General.Mvc/General.Mvc.csproj"
COPY . .
WORKDIR "/src/General.Mvc"
RUN dotnet build "General.Mvc.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "General.Mvc.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "General.Mvc.dll"]